﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;

namespace EasyUIMvc
{
    public class WindowExtension : ExtensionBase
    {
        private readonly WindowSettings _settings;
        private MvcHtmlString _content;

        public WindowExtension(WindowSettings settings)
        {
            this._settings = settings;
        }
        public WindowExtension Content(string content)
        {
            this._content = MvcHtmlString.Create(content);
            return this;
        }
        public override string GetScripts()
        {
            throw new NotImplementedException();
        }
        public override MvcHtmlString GetHtml()
        {
            var window = GetTopTag("div", "easyui-window", _settings);
            window.MergeAttribute("style", _settings.Style);
            window.MergeAttribute("title", _settings.Title);
            window.InnerHtml += _content;
            return MvcHtmlString.Create(window.ToString());
        }
    }

    public class WindowSettings : SettingsBase
    {
        public string Title { get; set; }

        public string Style { get; set; }
    }
}
